import type { RequestConfig,HttpResponse } from "@/types/http";

const baseUrl: string = "http://192.168.31.200:3000";


export function request(config: RequestConfig): Promise<HttpResponse> {
  return new Promise((resolve, reject) => {
    uni.request({
      url: baseUrl + config.url,
      method: config.method,
      header: config.header,
      timeout: 5000,
      data: config.data,
      success: (result: HttpResponse | any) => {
        resolve(result);
      },
      fail: (error) => {
        reject(error);
      },
      complete: () => {},
    });
  });
}
